<template>
	<view>
		<cu-custom :key="'header'+headerKey" bgColor="bg-gradual-blue" title="信义金" 
		:isBack="true" backText="返回"></cu-custom>
		<view class="main">
			<best-gauge :config="gaugeOption0" class="dashboard"></best-gauge>
			<image :src='bgimgurl' class="bgdashboard"></image>
			<view class="fromText">
				<view class="desText">信义金信息取自</view>
				<view class="desText">金华市信用金华建设领导小组办公室</view>
			</view>
		</view>
		<u-modal v-model="modelShow"  :content="modelContent" :confirm-color="'#f37b1d'"></u-modal>
		
	</view>
</template>

<script>
	import api from '@/api/society/home/home.js';
	import bestGauge from '@/components/best-gauge/best-gauge.vue';
 	export default {
		onShow() {
			this.headerKey += 1;
		},
 		components: {
 			bestGauge
 		},
 		data() {
 			return {
				headerKey:0,
				modelShow:false,
				modelContent:'',
				gaugeOption0:{
					id: 'gaugeId0',
					value: 0,
					creditDes:'',
				},
				bgimgurl:'https://ewm.rsj.jinhua.gov.cn/jhrs/api/common/file/show/jycy/37ac8a8850b14912afca32a88d463119'
 			}
 		},
		onReady(){
			this.init();
		},
 		methods: {
			init(){
				const info = {};
				this.$http.post(api.getCreditInfo,info).then(res => {
					if(res.code==0){
						let a= res.result.jhscore;
						let level = res.result.level;
						if(a==null || a=="" || a==undefined){
							this.modelContent='未查询到您的信义金'
							this.modelShow = true
						}
						if(a>=0 && a<=1000){
							this.gaugeOption0.value = a;
							this.gaugeOption0.creditDes = level;
						}
					}
				}).catch(error => {
					this.gaugeOption0.value = 0;
					this.gaugeOption0.creditDes = '查询失败';
				})
			}
 		}
 	}
 </script>

<style>
	page{
		background-color: #ffffff;
	}
	.main{
		width: 750upx;
		height:1214upx;
		display: flex;
		justify-content: center;
		position:absolute;
	}
	.dashboard{
		width: 498upx;
		height: 498upx;
		margin-top:183upx;
	}
	.bgdashboard{
		width: 748upx;
		height: 261upx;
		position: absolute;
	    top:530upx;
	    left:0;
	    z-index:-1;
		mode:aspectFit;
	}
	.fromText{
		width: 576upx;
		height: 110upx;
		position: absolute;
	    top:842upx;
	    left:86;
	}
	.desText{
		font-family: PingFangSC-Semibold;
		font-size: 36upx;
		color: #1960CF;
		letter-spacing: 0;
		text-align: center;
		line-height: 55upx;
	}
	

</style>

